<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title>商品表的设计和商品添加业务 | mff&#39;s personal blog</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1">
    <meta name="generator" content="Hugo 0.69.0" />
    
    
      <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
    

    
    
      <link href="/hugoblog/dist/css/app.1cb140d8ba31d5b2f1114537dd04802a.css" rel="stylesheet">
    

    

    
      
    

    
    
    <meta property="og:title" content="商品表的设计和商品添加业务" />
<meta property="og:description" content="" />
<meta property="og:type" content="article" />
<meta property="og:url" content="/hugoblog/posts/%E5%95%86%E5%93%81%E8%A1%A8%E7%9A%84%E8%AE%BE%E8%AE%A1%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%95%86%E5%93%81%E4%B8%9A%E5%8A%A1/" />
<meta property="article:published_time" content="2020-05-06T23:03:11+08:00" />
<meta property="article:modified_time" content="2020-05-06T23:03:11+08:00" />
<meta itemprop="name" content="商品表的设计和商品添加业务">
<meta itemprop="description" content="">
<meta itemprop="datePublished" content="2020-05-06T23:03:11&#43;08:00" />
<meta itemprop="dateModified" content="2020-05-06T23:03:11&#43;08:00" />
<meta itemprop="wordCount" content="604">



<meta itemprop="keywords" content="" /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="商品表的设计和商品添加业务"/>
<meta name="twitter:description" content=""/>

  </head>

  <body class="ma0 avenir bg-near-white">

    
   
  

  <header>
    <div class="bg-black">
      <nav class="pv3 ph3 ph4-ns" role="navigation">
  <div class="flex-l justify-between items-center center">
    <a href="/hugoblog/" class="f3 fw2 hover-white no-underline white-90 dib">
      mff&#39;s personal blog
    </a>
    <div class="flex-l items-center">
      

      
        <ul class="pl0 mr3">
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/hugoblog/posts/" title="Posts page">
              Posts
            </a>
          </li>
          
        </ul>
      
      






<a href="https://www.bilibili.com/" target="_blank" class="link-transition youtube link dib z-999 pt3 pt0-l mr1" title="Youtube link" rel="noopener" aria-label="follow on Youtube——Opens in a new window">
  <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M42.527,41.34c-0.278,0-0.478,0.078-0.6,0.244  c-0.121,0.156-0.18,0.424-0.18,0.796v0.896h1.543V42.38c0-0.372-0.062-0.64-0.185-0.796C42.989,41.418,42.792,41.34,42.527,41.34z   M36.509,41.309c0.234,0,0.417,0.076,0.544,0.23c0.123,0.155,0.185,0.383,0.185,0.682v4.584c0,0.286-0.053,0.487-0.153,0.611  c-0.1,0.127-0.256,0.189-0.47,0.189c-0.148,0-0.287-0.033-0.421-0.096c-0.135-0.062-0.274-0.171-0.415-0.313v-5.531  c0.119-0.122,0.239-0.213,0.36-0.271C36.26,41.335,36.383,41.309,36.509,41.309z M41.748,44.658v1.672  c0,0.468,0.057,0.792,0.17,0.974c0.118,0.181,0.313,0.269,0.592,0.269c0.289,0,0.491-0.076,0.606-0.229  c0.114-0.153,0.175-0.489,0.175-1.013v-0.405h1.795v0.456c0,0.911-0.217,1.596-0.657,2.059c-0.435,0.459-1.089,0.687-1.958,0.687  c-0.781,0-1.398-0.242-1.847-0.731c-0.448-0.486-0.676-1.157-0.676-2.014v-3.986c0-0.768,0.249-1.398,0.742-1.882  c0.493-0.484,1.128-0.727,1.911-0.727c0.799,0,1.413,0.225,1.843,0.674c0.429,0.448,0.642,1.093,0.642,1.935v2.264H41.748z   M38.623,48.495c-0.271,0.336-0.669,0.501-1.187,0.501c-0.343,0-0.646-0.062-0.912-0.192c-0.267-0.129-0.519-0.327-0.746-0.601  v0.681h-1.764V36.852h1.764v3.875c0.237-0.27,0.485-0.478,0.748-0.616c0.267-0.143,0.534-0.212,0.805-0.212  c0.554,0,0.975,0.189,1.265,0.565c0.294,0.379,0.438,0.933,0.438,1.66v4.926C39.034,47.678,38.897,48.159,38.623,48.495z   M30.958,48.884v-0.976c-0.325,0.361-0.658,0.636-1.009,0.822c-0.349,0.191-0.686,0.282-1.014,0.282  c-0.405,0-0.705-0.129-0.913-0.396c-0.201-0.266-0.305-0.658-0.305-1.189v-7.422h1.744v6.809c0,0.211,0.037,0.362,0.107,0.457  c0.077,0.095,0.196,0.141,0.358,0.141c0.128,0,0.292-0.062,0.488-0.188c0.197-0.125,0.375-0.283,0.542-0.475v-6.744h1.744v8.878  H30.958z M24.916,38.6v10.284h-1.968V38.6h-2.034v-1.748h6.036V38.6H24.916z M32.994,32.978c0-0.001,12.08,0.018,13.514,1.45  c1.439,1.435,1.455,8.514,1.455,8.555c0,0-0.012,7.117-1.455,8.556C45.074,52.969,32.994,53,32.994,53s-12.079-0.031-13.516-1.462  c-1.438-1.435-1.441-8.502-1.441-8.556c0-0.041,0.004-7.12,1.441-8.555C20.916,32.996,32.994,32.977,32.994,32.978z M42.52,29.255  h-1.966v-1.08c-0.358,0.397-0.736,0.703-1.13,0.909c-0.392,0.208-0.771,0.312-1.14,0.312c-0.458,0-0.797-0.146-1.027-0.437  c-0.229-0.291-0.345-0.727-0.345-1.311v-8.172h1.962v7.497c0,0.231,0.045,0.399,0.127,0.502c0.08,0.104,0.216,0.156,0.399,0.156  c0.143,0,0.327-0.069,0.548-0.206c0.22-0.137,0.423-0.312,0.605-0.527v-7.422h1.966V29.255z M31.847,27.588  c0.139,0.147,0.339,0.219,0.6,0.219c0.266,0,0.476-0.075,0.634-0.223c0.157-0.152,0.235-0.358,0.235-0.618v-5.327  c0-0.214-0.08-0.387-0.241-0.519c-0.16-0.131-0.37-0.196-0.628-0.196c-0.241,0-0.435,0.065-0.586,0.196  c-0.148,0.132-0.225,0.305-0.225,0.519v5.327C31.636,27.233,31.708,27.439,31.847,27.588z M30.408,19.903  c0.528-0.449,1.241-0.674,2.132-0.674c0.812,0,1.48,0.237,2.001,0.711c0.517,0.473,0.777,1.083,0.777,1.828v5.051  c0,0.836-0.255,1.491-0.762,1.968c-0.513,0.476-1.212,0.714-2.106,0.714c-0.858,0-1.547-0.246-2.064-0.736  c-0.513-0.492-0.772-1.152-0.772-1.983v-5.068C29.613,20.954,29.877,20.351,30.408,19.903z M24.262,16h-2.229l2.634,8.003v5.252  h2.213v-5.5L29.454,16h-2.25l-1.366,5.298h-0.139L24.262,16z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4s30,13.431,30,30  S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://weibo.com/" target="_blank" class="link-transition linkedin link dib z-999 pt3 pt0-l mr1" title="LinkedIn link" rel="noopener" aria-label="follow on LinkedIn——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://mff-project.gitee.io/hugoblog/" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-label="follow on Github——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://gitee.com/mff-project" target="_blank" class="link-transition gitlab link dib z-999 pt3 pt0-l mr1" title="Gitlab link" rel="noopener" aria-label="follow on Gitlab——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z"></path></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>






    </div>
  </div>
</nav>

    </div>
  </header>



    <main class="pb7" role="main">
      
  
  <article class="flex-l flex-wrap justify-between mw8 center ph3">
    <header class="mt4 w-100">
      <aside class="instapaper_ignoref b helvetica tracked">
          
        POSTS
      </aside>
      




  <div id="sharing" class="mt3">

    
    <a href="https://www.facebook.com/sharer.php?u=/hugoblog/posts/%E5%95%86%E5%93%81%E8%A1%A8%E7%9A%84%E8%AE%BE%E8%AE%A1%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%95%86%E5%93%81%E4%B8%9A%E5%8A%A1/" class="facebook no-underline" aria-label="share on Facebook">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M28.765,50.32h6.744V33.998h4.499l0.596-5.624h-5.095  l0.007-2.816c0-1.466,0.14-2.253,2.244-2.253h2.812V17.68h-4.5c-5.405,0-7.307,2.729-7.307,7.317v3.377h-3.369v5.625h3.369V50.32z   M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;"/></svg>

    </a>

    
    
    <a href="https://twitter.com/share?url=/hugoblog/posts/%E5%95%86%E5%93%81%E8%A1%A8%E7%9A%84%E8%AE%BE%E8%AE%A1%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%95%86%E5%93%81%E4%B8%9A%E5%8A%A1/&amp;text=%e5%95%86%e5%93%81%e8%a1%a8%e7%9a%84%e8%ae%be%e8%ae%a1%e5%92%8c%e5%95%86%e5%93%81%e6%b7%bb%e5%8a%a0%e4%b8%9a%e5%8a%a1" class="twitter no-underline" aria-label="share on Twitter">
      <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M37.167,22.283c-2.619,0.953-4.274,3.411-4.086,6.101  l0.063,1.038l-1.048-0.127c-3.813-0.487-7.145-2.139-9.974-4.915l-1.383-1.377l-0.356,1.017c-0.754,2.267-0.272,4.661,1.299,6.271  c0.838,0.89,0.649,1.017-0.796,0.487c-0.503-0.169-0.943-0.296-0.985-0.233c-0.146,0.149,0.356,2.076,0.754,2.839  c0.545,1.06,1.655,2.097,2.871,2.712l1.027,0.487l-1.215,0.021c-1.173,0-1.215,0.021-1.089,0.467  c0.419,1.377,2.074,2.839,3.918,3.475l1.299,0.444l-1.131,0.678c-1.676,0.976-3.646,1.526-5.616,1.568  C19.775,43.256,19,43.341,19,43.405c0,0.211,2.557,1.397,4.044,1.864c4.463,1.377,9.765,0.783,13.746-1.568  c2.829-1.673,5.657-5,6.978-8.221c0.713-1.716,1.425-4.851,1.425-6.354c0-0.975,0.063-1.102,1.236-2.267  c0.692-0.678,1.341-1.419,1.467-1.631c0.21-0.403,0.188-0.403-0.88-0.043c-1.781,0.636-2.033,0.551-1.152-0.402  c0.649-0.678,1.425-1.907,1.425-2.267c0-0.063-0.314,0.042-0.671,0.233c-0.377,0.212-1.215,0.53-1.844,0.72l-1.131,0.361l-1.027-0.7  c-0.566-0.381-1.361-0.805-1.781-0.932C39.766,21.902,38.131,21.944,37.167,22.283z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4  s30,13.431,30,30S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

    </a>

    
    <a href="https://www.linkedin.com/shareArticle?mini=true&amp;url=/hugoblog/posts/%E5%95%86%E5%93%81%E8%A1%A8%E7%9A%84%E8%AE%BE%E8%AE%A1%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%95%86%E5%93%81%E4%B8%9A%E5%8A%A1/&amp;title=%e5%95%86%e5%93%81%e8%a1%a8%e7%9a%84%e8%ae%be%e8%ae%a1%e5%92%8c%e5%95%86%e5%93%81%e6%b7%bb%e5%8a%a0%e4%b8%9a%e5%8a%a1" class="linkedin no-underline" aria-label="share on LinkedIn">
      <svg  height="32px"  style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>

    </a>
  </div>

      <h1 class="f1 athelas mt3 mb1">商品表的设计和商品添加业务</h1>
      
      
      <time class="f6 mv4 dib tracked" datetime="2020-05-06T23:03:11&#43;08:00">May 6, 2020</time>

      
      
    </header>
    <div class="nested-copy-line-height lh-copy serif f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l"><h3 id="设计图">设计图</h3>
<p><img src="../imgs/%E5%95%86%E5%93%81%E8%A1%A8%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE.jpg" alt="商品表思维导图"></p>
<p>当商品存为单表时，新增一种商品类别就得新建一张表，上万种商品类就得建上万张表，虽然能提供良好的检索服务，但使很难维护</p>
<p>而右边图将所有商品以json形式存储到一张表里，易维护，但是检索服务比较繁琐，这也是唯一的缺点</p>
<p>建立一对多关系模型</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#f92672">from</span> django.db <span style="color:#f92672">import</span> models
<span style="color:#75715e"># 导入时间域</span>
<span style="color:#f92672">from</span> django.utils <span style="color:#f92672">import</span> timezone

<span style="color:#75715e"># 基类</span>
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Base</span>(models<span style="color:#f92672">.</span>Model):
    <span style="color:#75715e">#时间字段</span>
    create_time <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>DateTimeField(default<span style="color:#f92672">=</span>timezone<span style="color:#f92672">.</span>now,null<span style="color:#f92672">=</span>True)

    <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Meta</span>:
        abstract <span style="color:#f92672">=</span> True
<span style="color:#75715e"># 商品表</span>
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Goods</span>(Base):
    <span style="color:#75715e"># 名称</span>
    name <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span>)
    <span style="color:#75715e"># 商品描述</span>
    desc <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span>,null<span style="color:#f92672">=</span>True)
    <span style="color:#75715e"># 图片</span>
    img <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span>)
    <span style="color:#75715e"># 展示视频</span>
    video <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span>,null<span style="color:#f92672">=</span>True)
    <span style="color:#75715e"># 价格</span>
    price <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>IntegerField()
    <span style="color:#75715e"># 规格</span>
    params <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">400</span>)
    <span style="color:#75715e"># 关注数</span>
    flows <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>IntegerField(default<span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>,null<span style="color:#f92672">=</span>True)
    <span style="color:#75715e"># 外键关系(这里的外键可以理解为逻辑外键，可以实现外键的功能，但不会受到外键的约束)</span>
    cid <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>IntegerField(null<span style="color:#f92672">=</span>True)


    <span style="color:#75715e"># 声明表名</span>
    <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Meta</span>:
        db_table <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;goods&#34;</span>

<span style="color:#75715e"># 商品类表</span>
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Category</span>(Base):
    name <span style="color:#f92672">=</span> models<span style="color:#f92672">.</span>CharField(max_length<span style="color:#f92672">=</span><span style="color:#ae81ff">200</span>,null<span style="color:#f92672">=</span>True)

        <span style="color:#75715e"># 声明表名</span>
    <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Meta</span>:
        db_table <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;category&#34;</span>
</code></pre></div><p>执行迁移命令生成数据表</p>
<p>新建序列化操作文件(myser.py)</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#75715e">#导包</span>
<span style="color:#f92672">from</span> rest_framework <span style="color:#f92672">import</span> serializers

<span style="color:#75715e"># 导入需要序列化的表</span>
<span style="color:#f92672">from</span> myapp.models <span style="color:#f92672">import</span> Goods,Category

<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">GoodsSer</span>(serializers<span style="color:#f92672">.</span>ModelSerializer):

    <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Meta</span>:
        model <span style="color:#f92672">=</span> Goods
        fields <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;__all__&#34;</span>
        
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">CategorySer</span>(serializers<span style="color:#f92672">.</span>ModelSerializer):

    <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">Meta</span>:
        model <span style="color:#f92672">=</span> Category
        fields <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;__all__&#34;</span>
</code></pre></div><p>新建商品(goods.py)文件</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-python" data-lang="python"><span style="color:#f92672">from</span> rest_framework.views <span style="color:#f92672">import</span> APIView
<span style="color:#f92672">from</span> myapp.models <span style="color:#f92672">import</span> Goods,Category
<span style="color:#f92672">from</span> myapp.myser <span style="color:#f92672">import</span> GoodsSer,CategorySer
<span style="color:#f92672">from</span> rest_framework.response <span style="color:#f92672">import</span> Response

<span style="color:#75715e"># 商品分类</span>
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">CategoryList</span>(APIView):
    <span style="color:#66d9ef">def</span> <span style="color:#a6e22e">get</span>(self,request):
        
        category <span style="color:#f92672">=</span> Category<span style="color:#f92672">.</span>objects<span style="color:#f92672">.</span>all()

        category_ser <span style="color:#f92672">=</span> CategorySer(category,many<span style="color:#f92672">=</span>True)

        <span style="color:#66d9ef">return</span> Response(category_ser<span style="color:#f92672">.</span>data)
    
    
<span style="color:#75715e"># 商品入库</span>
<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">InsertGoods</span>(APIView):
    <span style="color:#66d9ef">def</span> <span style="color:#a6e22e">get</span>(self,requests):
        <span style="color:#75715e"># 接参</span>
        name <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;name&#39;</span>,None)
        price <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;price&#39;</span>,None)
        <span style="color:#75715e"># 这里接收数据为数组，以字符串的方式进行存储</span>
        params <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;param&#39;</span>,None)
        img <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;img&#39;</span>,None)
        video <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;video&#39;</span>,None)
        selected <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>GET<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#39;selected&#39;</span>,None)

        <span style="color:#75715e"># 排重操作</span>
        goods <span style="color:#f92672">=</span> Goods<span style="color:#f92672">.</span>objects<span style="color:#f92672">.</span>filter(name<span style="color:#f92672">=</span>name)<span style="color:#f92672">.</span>first()

        <span style="color:#66d9ef">if</span> goods:

            <span style="color:#66d9ef">return</span> Response({<span style="color:#e6db74">&#39;code&#39;</span>:<span style="color:#ae81ff">403</span>,<span style="color:#e6db74">&#34;message&#34;</span>:<span style="color:#e6db74">&#34;您以添加过商品&#34;</span>})

        <span style="color:#75715e"># 查询商品分类id</span>
        category <span style="color:#f92672">=</span> Category<span style="color:#f92672">.</span>objects<span style="color:#f92672">.</span>filter(name<span style="color:#f92672">=</span>selected)<span style="color:#f92672">.</span>first()

        <span style="color:#75715e"># 入库</span>
        goods <span style="color:#f92672">=</span> Goods(name<span style="color:#f92672">=</span>name,price<span style="color:#f92672">=</span>price,params<span style="color:#f92672">=</span>params,img<span style="color:#f92672">=</span>img,cid<span style="color:#f92672">=</span>category<span style="color:#f92672">.</span>id,video<span style="color:#f92672">=</span>video)

        goods<span style="color:#f92672">.</span>save()
        
        <span style="color:#66d9ef">return</span> Response({<span style="color:#e6db74">&#39;code&#39;</span>:<span style="color:#ae81ff">200</span>,<span style="color:#e6db74">&#34;message&#34;</span>:<span style="color:#e6db74">&#34;添加成功&#34;</span>})
</code></pre></div><p>这里是一个添加分类和商品的接口，记得配好接口路由</p>
<p>对应前端(vue.js)做相应操作</p>
<p>新建添加商品(addgoods.vue)文件</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-vue" data-lang="vue">&lt;<span style="color:#f92672">template</span>&gt;
    &lt;<span style="color:#f92672">div</span>&gt;
        &lt;<span style="color:#f92672">myheader</span>&gt;&lt;/<span style="color:#f92672">myheader</span>&gt;

        &lt;<span style="color:#f92672">section</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;featured-block text-center&#34;</span>&gt;
            &lt;<span style="color:#f92672">div</span> <span style="color:#a6e22e">class</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;container&#34;</span>&gt;
                &lt;<span style="color:#f92672">div</span>&gt;
                    &lt;<span style="color:#f92672">Breadcrumb</span> <span style="color:#f92672">:datas</span><span style="color:#e6db74">=&#34;datas&#34;</span>&gt;&lt;/<span style="color:#f92672">Breadcrumb</span>&gt;
                &lt;/<span style="color:#f92672">div</span>&gt;
            &lt;/<span style="color:#f92672">div</span>&gt;
        &lt;/<span style="color:#f92672">section</span>&gt;
        
        &lt;<span style="color:#f92672">div</span>&gt;
            &lt;<span style="color:#f92672">table</span>&gt;
                &lt;<span style="color:#f92672">tr</span>&gt;
                    &lt;<span style="color:#f92672">td</span>&gt;
                        <span style="color:#a6e22e">商品分类</span><span style="color:#960050;background-color:#1e0010">：</span>
                    &lt;/<span style="color:#f92672">td</span>&gt;
                    &lt;<span style="color:#f92672">td</span>&gt;
                        &lt;<span style="color:#f92672">Select</span> <span style="color:#f92672">v-model</span><span style="color:#e6db74">=&#34;selected&#34; </span><span style="color:#f92672">:datas</span><span style="color:#e6db74">=&#34;category&#34;</span>&gt;&lt;/<span style="color:#f92672">Select</span>&gt;
                    &lt;/<span style="color:#f92672">td</span>&gt;
                &lt;/<span style="color:#f92672">tr</span>&gt;
                 &lt;<span style="color:#f92672">tr</span>&gt;
                    &lt;<span style="color:#f92672">td</span>&gt;
                        <span style="color:#a6e22e">商品名称</span><span style="color:#960050;background-color:#1e0010">：</span>
                    &lt;/<span style="color:#f92672">td</span>&gt;
                    &lt;<span style="color:#f92672">td</span>&gt;
                        &lt;<span style="color:#f92672">input</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;text&#34;</span> <span style="color:#f92672">v-model</span><span style="color:#e6db74">=&#34;name&#34; placeholder=&#34;请输入商品名称&#34;&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        商品价格：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;number&#34; v-model=&#34;price&#34; placeholder=0&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        颜色：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;text&#34; v-model=&#34;color&#34; placeholder=&#34;请输入商品颜色类&#34;&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        尺寸：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;text&#34; v-model=&#34;size&#34; placeholder=&#34;请输入商品尺寸&#34;&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        季节：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;text&#34; v-model=&#34;season&#34; placeholder=&#34;请输入季节类&#34;&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        上传商品图片：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;file&#34; @change=&#34;upload_qiniu&#34;&gt;
</span><span style="color:#e6db74">                        &lt;br&gt;
</span><span style="color:#e6db74">                        {{ load_percent }}
</span><span style="color:#e6db74">                        &lt;!-- 进度条标签 --&gt;
</span><span style="color:#e6db74">                        &lt;Progress :percent=&#34;load_int&#34; color=&#34;green&#34; v-show=&#34;load_int&#34;&gt;						&lt;/Progress&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        展示视频：
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;input type=&#34;file&#34; @change=&#34;upload_qiniu&#34;&gt;
</span><span style="color:#e6db74">                        &lt;br&gt;
</span><span style="color:#e6db74">                        {{ load_percent }}
</span><span style="color:#e6db74">                        &lt;Progress :percent=&#34;load_int&#34; color=&#34;green&#34; v-show=&#34;load_int&#34;&gt;						&lt;/Progress&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">                &lt;tr&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;&lt;/td&gt;
</span><span style="color:#e6db74">                    &lt;td&gt;
</span><span style="color:#e6db74">                        &lt;button @click=&#34;submit&#34;&gt;确定上传&lt;/button&gt;
</span><span style="color:#e6db74">                    &lt;/td&gt;
</span><span style="color:#e6db74">                &lt;/tr&gt;
</span><span style="color:#e6db74">            &lt;/table&gt;
</span><span style="color:#e6db74">        &lt;/div&gt;
</span><span style="color:#e6db74">        &lt;footer class=&#34;footer&#34;&gt;
</span><span style="color:#e6db74">            &lt;div class=&#34;container&#34;</span>&gt;
                <span style="color:#960050;background-color:#1e0010">@</span><span style="color:#a6e22e">v3u.cn</span>
            &lt;/<span style="color:#f92672">div</span>&gt;
        &lt;/<span style="color:#f92672">footer</span>&gt;
    &lt;/<span style="color:#f92672">div</span>&gt;
  
&lt;/<span style="color:#f92672">template</span>&gt;
&lt;<span style="color:#f92672">script</span>&gt;
<span style="color:#75715e">// 导入组件
</span><span style="color:#75715e"></span><span style="color:#66d9ef">import</span> <span style="color:#a6e22e">myheader</span> <span style="color:#a6e22e">from</span> <span style="color:#e6db74">&#39;./myheader.vue&#39;</span>
<span style="color:#75715e">// 导入文件
</span><span style="color:#75715e"></span><span style="color:#66d9ef">import</span> {<span style="color:#a6e22e">config</span>,<span style="color:#a6e22e">formatXml</span>} <span style="color:#a6e22e">from</span> <span style="color:#e6db74">&#39;../config.js&#39;</span>

<span style="color:#66d9ef">export</span> <span style="color:#66d9ef">default</span> {
    <span style="color:#a6e22e">data</span>(){
        <span style="color:#66d9ef">return</span>{
            <span style="color:#75715e">// 下拉框默认
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">selected</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;衣服&#39;</span>,
            <span style="color:#75715e">// 商品分类
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">category</span><span style="color:#f92672">:</span>[],
            <span style="color:#75715e">// 上传进度展示
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">load_percent</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#75715e">// 整型进度
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">load_int</span> <span style="color:#f92672">:</span> <span style="color:#ae81ff">0</span>,
            <span style="color:#75715e">// 视频链接
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">video</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#75715e">// 图片链接
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">src</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>, 
            <span style="color:#75715e">// 七牛云token
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">token</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#a6e22e">price</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#a6e22e">color</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#a6e22e">size</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#a6e22e">season</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;&#39;</span>,
            <span style="color:#75715e">// 面包屑导航变量
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">datas</span><span style="color:#f92672">:</span>[{<span style="color:#a6e22e">title</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;首页&#39;</span>,<span style="color:#a6e22e">route</span><span style="color:#f92672">:</span>{<span style="color:#a6e22e">name</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;index&#39;</span>}},{<span style="color:#a6e22e">title</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;添加商品&#39;</span>}]
        }
    },
    <span style="color:#a6e22e">components</span><span style="color:#f92672">:</span>{
        <span style="color:#e6db74">&#39;myheader&#39;</span><span style="color:#f92672">:</span><span style="color:#a6e22e">myheader</span>,
    },
    <span style="color:#75715e">// 钩子
</span><span style="color:#75715e"></span>    <span style="color:#a6e22e">mounted</span><span style="color:#f92672">:</span><span style="color:#66d9ef">function</span>(){
        <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">get_token</span>();
        <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">get_category</span>();

    },
    <span style="color:#a6e22e">methods</span><span style="color:#f92672">:</span>{
        <span style="color:#75715e">// 获取商品分类数据
</span><span style="color:#75715e"></span>        <span style="color:#a6e22e">get_category</span><span style="color:#f92672">:</span><span style="color:#66d9ef">function</span>(){
            
            <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">axios</span>.<span style="color:#a6e22e">get</span>(<span style="color:#e6db74">&#39;http://127.0.0.1:8000/categorylist/&#39;</span>).<span style="color:#a6e22e">then</span>((<span style="color:#a6e22e">result</span>)=&gt;{
                
                <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">result</span>);
                <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">mycate</span> <span style="color:#f92672">=</span> [];
                <span style="color:#75715e">// 二次处理数据
</span><span style="color:#75715e"></span>                <span style="color:#66d9ef">for</span> (<span style="color:#66d9ef">let</span> <span style="color:#a6e22e">i</span><span style="color:#f92672">=</span><span style="color:#ae81ff">0</span>;<span style="color:#a6e22e">i</span>&lt;<span style="color:#f92672">result</span><span style="color:#a6e22e">.data.length</span><span style="color:#960050;background-color:#1e0010">;</span><span style="color:#a6e22e">i</span><span style="color:#960050;background-color:#1e0010">++)</span>{
                    <span style="color:#a6e22e">mycate.push</span><span style="color:#960050;background-color:#1e0010">(</span><span style="color:#a6e22e">result.data</span><span style="color:#960050;background-color:#1e0010">[</span><span style="color:#a6e22e">i</span><span style="color:#960050;background-color:#1e0010">][&#39;</span><span style="color:#a6e22e">name</span><span style="color:#960050;background-color:#1e0010">&#39;]);</span>
                }<span style="color:#960050;background-color:#1e0010">;</span>
                <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">赋值</span>
                <span style="color:#a6e22e">this.category</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#a6e22e">mycate</span><span style="color:#960050;background-color:#1e0010">;</span>
            }<span style="color:#960050;background-color:#1e0010">);</span>


        }<span style="color:#960050;background-color:#1e0010">,</span>
        <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">获取七牛云token</span>   
        <span style="color:#a6e22e">get_token</span><span style="color:#f92672">:</span><span style="color:#a6e22e">function</span><span style="color:#960050;background-color:#1e0010">()</span>{
            <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">请求后台接口</span>
            <span style="color:#a6e22e">this.axios.get</span><span style="color:#960050;background-color:#1e0010">(&#34;</span><span style="color:#a6e22e">http</span><span style="color:#f92672">:</span><span style="color:#960050;background-color:#1e0010">//</span><span style="color:#a6e22e">127.0.0.1</span><span style="color:#f92672">:</span><span style="color:#a6e22e">8000</span><span style="color:#960050;background-color:#1e0010">/</span><span style="color:#a6e22e">qiniu</span><span style="color:#960050;background-color:#1e0010">/&#34;)</span><span style="color:#a6e22e">.then</span><span style="color:#960050;background-color:#1e0010">((</span><span style="color:#a6e22e">result</span><span style="color:#960050;background-color:#1e0010">)=</span>&gt;{
                <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">result</span>);
                <span style="color:#75715e">// 赋值给token
</span><span style="color:#75715e"></span>                <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">token</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">data</span>.<span style="color:#a6e22e">token</span>;
                <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">token</span>);
            });
        },
        <span style="color:#75715e">// 上传文件
</span><span style="color:#75715e"></span>        <span style="color:#a6e22e">upload_qiniu</span><span style="color:#f92672">:</span><span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">e</span>){
            <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">size</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>;
            <span style="color:#75715e">// 获取文件
</span><span style="color:#75715e"></span>            <span style="color:#66d9ef">let</span> <span style="color:#a6e22e">file</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">target</span>.<span style="color:#a6e22e">files</span>[<span style="color:#ae81ff">0</span>];
            <span style="color:#a6e22e">size</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">file</span>.<span style="color:#a6e22e">size</span>;
            <span style="color:#a6e22e">size</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">size</span> <span style="color:#f92672">/</span> <span style="color:#ae81ff">1024</span>;
            <span style="color:#a6e22e">size</span> <span style="color:#f92672">=</span> (<span style="color:#a6e22e">size</span> <span style="color:#f92672">/</span> <span style="color:#ae81ff">1024</span>).<span style="color:#a6e22e">toFixed</span>(<span style="color:#ae81ff">3</span>);
            <span style="color:#75715e">// 声明表单参数
</span><span style="color:#75715e"></span>            <span style="color:#66d9ef">let</span> <span style="color:#a6e22e">param</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">FormData</span>();
            <span style="color:#75715e">// 文件添加到param
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">param</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;file&#39;</span>,<span style="color:#a6e22e">file</span>,<span style="color:#a6e22e">file</span>.<span style="color:#a6e22e">name</span>);
            <span style="color:#75715e">// 添加token
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">param</span>.<span style="color:#a6e22e">append</span>(<span style="color:#e6db74">&#39;token&#39;</span>,<span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">token</span>);
            <span style="color:#75715e">// 自定义axios
</span><span style="color:#75715e"></span>            <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">axios_qiniu</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">axios</span>.<span style="color:#a6e22e">create</span>({<span style="color:#a6e22e">withCredentials</span><span style="color:#f92672">:</span><span style="color:#66d9ef">false</span>});
            <span style="color:#75715e">// 发送请求
</span><span style="color:#75715e"></span>            <span style="color:#a6e22e">axios_qiniu</span>({
                <span style="color:#a6e22e">method</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;POST&#39;</span>,
                <span style="color:#a6e22e">url</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;http://up-z1.qiniu.com/&#39;</span>,
                <span style="color:#a6e22e">data</span><span style="color:#f92672">:</span><span style="color:#a6e22e">param</span>,
                <span style="color:#a6e22e">timeout</span><span style="color:#f92672">:</span><span style="color:#ae81ff">30000</span>,
                <span style="color:#75715e">// 上传过程中的方法
</span><span style="color:#75715e"></span>                <span style="color:#a6e22e">onUploadProgress</span><span style="color:#f92672">:</span>(<span style="color:#a6e22e">e</span>)=&gt;{
                    <span style="color:#75715e">// 计算上传百分比
</span><span style="color:#75715e"></span>                    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">complete</span> <span style="color:#f92672">=</span> (<span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">loaded</span> <span style="color:#f92672">/</span> <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">total</span>);
                    <span style="color:#75715e">// 处理美化
</span><span style="color:#75715e"></span>                    <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">complete</span> <span style="color:#f92672">&lt;</span> <span style="color:#ae81ff">1</span>){
                        <span style="color:#75715e">// (complete为以完成的量 * 100).保留两位小数 + &#39;%&#39;
</span><span style="color:#75715e"></span>                        <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">load_percent</span>  <span style="color:#f92672">=</span> (<span style="color:#a6e22e">complete</span> <span style="color:#f92672">*</span> <span style="color:#ae81ff">100</span>).<span style="color:#a6e22e">toFixed</span>(<span style="color:#ae81ff">2</span>) <span style="color:#f92672">+</span> <span style="color:#e6db74">&#39;%&#39;</span>;
                        <span style="color:#75715e">// 整型进度
</span><span style="color:#75715e"></span>                        <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">load_int</span> <span style="color:#f92672">=</span> parseInt((<span style="color:#a6e22e">complete</span> <span style="color:#f92672">*</span> <span style="color:#ae81ff">100</span>).<span style="color:#a6e22e">toFixed</span>(<span style="color:#ae81ff">2</span>));
                    };
                }                
            }).<span style="color:#a6e22e">then</span>((<span style="color:#a6e22e">result</span>)=&gt;{
                <span style="color:#75715e">// 手动赋值%100(防止用户上传完成compltet还在计算)
</span><span style="color:#75715e"></span>                <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">load_percent</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;100%&#39;</span>;
                <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">load_int</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">100</span>;
                <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">data</span>);
                <span style="color:#75715e">// 这里判断用户的文件是否大于4m
</span><span style="color:#75715e"></span>                <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">size</span>&lt;<span style="color:#f92672">4</span><span style="color:#960050;background-color:#1e0010">)</span>{
                    <span style="color:#a6e22e">this.src</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#960050;background-color:#1e0010">&#39;</span><span style="color:#a6e22e">http</span><span style="color:#f92672">:</span><span style="color:#960050;background-color:#1e0010">//</span><span style="color:#a6e22e">q9xyoh7sx.bkt.clouddn.com</span><span style="color:#960050;background-color:#1e0010">/&#39;</span> <span style="color:#960050;background-color:#1e0010">+</span> <span style="color:#a6e22e">result.data.key</span><span style="color:#960050;background-color:#1e0010">;</span>
                }<span style="color:#a6e22e">else</span>{
                    <span style="color:#a6e22e">this.video</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#960050;background-color:#1e0010">&#39;</span><span style="color:#a6e22e">http</span><span style="color:#f92672">:</span><span style="color:#960050;background-color:#1e0010">//</span><span style="color:#a6e22e">q9xyoh7sx.bkt.clouddn.com</span><span style="color:#960050;background-color:#1e0010">/&#39;</span> <span style="color:#960050;background-color:#1e0010">+</span> <span style="color:#a6e22e">result.data.key</span>
                }
            }<span style="color:#960050;background-color:#1e0010">)</span>
        }<span style="color:#960050;background-color:#1e0010">,</span>
        <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">添加商品</span>
        <span style="color:#a6e22e">submit</span><span style="color:#f92672">:</span><span style="color:#a6e22e">function</span><span style="color:#960050;background-color:#1e0010">()</span>{
            <span style="color:#a6e22e">console.log</span><span style="color:#960050;background-color:#1e0010">(</span><span style="color:#a6e22e">this.selected</span><span style="color:#960050;background-color:#1e0010">);</span>
            <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">将普通字段转换为json</span>
            <span style="color:#a6e22e">var</span> <span style="color:#a6e22e">param </span><span style="color:#f92672">=</span> {}<span style="color:#960050;background-color:#1e0010">;</span>

            <span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">[&#39;</span><span style="color:#a6e22e">color</span><span style="color:#960050;background-color:#1e0010">&#39;]</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#a6e22e">this.color</span><span style="color:#960050;background-color:#1e0010">;</span>
            <span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">[&#39;</span><span style="color:#a6e22e">size</span><span style="color:#960050;background-color:#1e0010">&#39;]</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#a6e22e">this.size</span><span style="color:#960050;background-color:#1e0010">;</span>
            <span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">[&#39;</span><span style="color:#a6e22e">season</span><span style="color:#960050;background-color:#1e0010">&#39;]</span> <span style="color:#960050;background-color:#1e0010">=</span> <span style="color:#a6e22e">this.season</span><span style="color:#960050;background-color:#1e0010">;</span>
            <span style="color:#960050;background-color:#1e0010">//</span> <span style="color:#a6e22e">转换为字符串</span>
            <span style="color:#a6e22e">param </span><span style="color:#f92672">=</span> <span style="color:#a6e22e">JSON.stringify</span><span style="color:#960050;background-color:#1e0010">(</span><span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">);</span>
            <span style="color:#a6e22e">console.log</span><span style="color:#960050;background-color:#1e0010">(</span><span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">);</span>
            <span style="color:#a6e22e">this.axios.get</span><span style="color:#960050;background-color:#1e0010">(&#39;</span><span style="color:#a6e22e">http</span><span style="color:#f92672">:</span><span style="color:#960050;background-color:#1e0010">//</span><span style="color:#a6e22e">127.0.0.1</span><span style="color:#f92672">:</span><span style="color:#a6e22e">8000</span><span style="color:#960050;background-color:#1e0010">/</span><span style="color:#a6e22e">insertgoods</span><span style="color:#960050;background-color:#1e0010">/&#39;,</span>{<span style="color:#a6e22e">params</span><span style="color:#f92672">:</span>{<span style="color:#a6e22e">name</span><span style="color:#f92672">:</span><span style="color:#a6e22e">this.name</span><span style="color:#960050;background-color:#1e0010">,</span><span style="color:#a6e22e">price</span><span style="color:#f92672">:</span><span style="color:#a6e22e">this.price</span><span style="color:#960050;background-color:#1e0010">,</span><span style="color:#a6e22e">img</span><span style="color:#f92672">:</span><span style="color:#a6e22e">this.src</span><span style="color:#960050;background-color:#1e0010">,</span><span style="color:#a6e22e">param</span><span style="color:#f92672">:</span><span style="color:#a6e22e">param</span><span style="color:#960050;background-color:#1e0010">,</span><span style="color:#a6e22e">selected</span><span style="color:#f92672">:</span><span style="color:#a6e22e">this.selected</span><span style="color:#960050;background-color:#1e0010">,</span><span style="color:#a6e22e">video</span><span style="color:#f92672">:</span><span style="color:#a6e22e">this.video</span>}}<span style="color:#960050;background-color:#1e0010">)</span><span style="color:#a6e22e">.then</span><span style="color:#960050;background-color:#1e0010">((</span><span style="color:#a6e22e">result</span><span style="color:#960050;background-color:#1e0010">)=</span>&gt;{

                <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">result</span>);

                <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">$Message</span>(<span style="color:#a6e22e">result</span>.<span style="color:#a6e22e">data</span>.<span style="color:#a6e22e">message</span>);
            })
        }     
    }
}
&lt;/<span style="color:#f92672">script</span>&gt;
</code></pre></div><p>这里需要注意的是，商品规格是为数组，需将数组拆分为对应字段供用户添加商品使用，当用户点击提交时，将拆分的数据转化为json格式，再将json转换为字符串进行存储</p>
<p>上传文件接口为七牛云上传文件接口，具体参照（七牛云进度条显示上传文件.md）</p>
<p>头部组件参照(实现模拟注册登录.md)进行复制</p>
<p>存储后的数据，建议测试json格式</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json">{<span style="color:#f92672">&#34;color&#34;</span>:<span style="color:#e6db74">&#34;玫瑰红&#34;</span>,<span style="color:#f92672">&#34;size&#34;</span>:<span style="color:#e6db74">&#34;长度为149.1mm，厚度为7.57mm&#34;</span>,<span style="color:#f92672">&#34;season&#34;</span>:<span style="color:#e6db74">&#34;&#34;</span>}
</code></pre></div><ul class="pa0">
  
</ul>
<div class="mt6 instapaper_ignoref">
      
      
      </div>
    </div>

    <aside class="w-30-l mt6-l">




</aside>

  </article>

    </main>
    <footer class="bg-black bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="/hugoblog/" >
    &copy;  mff's personal blog 2020 
  </a>
    <div>






<a href="https://www.bilibili.com/" target="_blank" class="link-transition youtube link dib z-999 pt3 pt0-l mr1" title="Youtube link" rel="noopener" aria-label="follow on Youtube——Opens in a new window">
  <svg height="32px"  style="enable-background:new 0 0 67 67;" version="1.1" viewBox="0 0 67 67" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M42.527,41.34c-0.278,0-0.478,0.078-0.6,0.244  c-0.121,0.156-0.18,0.424-0.18,0.796v0.896h1.543V42.38c0-0.372-0.062-0.64-0.185-0.796C42.989,41.418,42.792,41.34,42.527,41.34z   M36.509,41.309c0.234,0,0.417,0.076,0.544,0.23c0.123,0.155,0.185,0.383,0.185,0.682v4.584c0,0.286-0.053,0.487-0.153,0.611  c-0.1,0.127-0.256,0.189-0.47,0.189c-0.148,0-0.287-0.033-0.421-0.096c-0.135-0.062-0.274-0.171-0.415-0.313v-5.531  c0.119-0.122,0.239-0.213,0.36-0.271C36.26,41.335,36.383,41.309,36.509,41.309z M41.748,44.658v1.672  c0,0.468,0.057,0.792,0.17,0.974c0.118,0.181,0.313,0.269,0.592,0.269c0.289,0,0.491-0.076,0.606-0.229  c0.114-0.153,0.175-0.489,0.175-1.013v-0.405h1.795v0.456c0,0.911-0.217,1.596-0.657,2.059c-0.435,0.459-1.089,0.687-1.958,0.687  c-0.781,0-1.398-0.242-1.847-0.731c-0.448-0.486-0.676-1.157-0.676-2.014v-3.986c0-0.768,0.249-1.398,0.742-1.882  c0.493-0.484,1.128-0.727,1.911-0.727c0.799,0,1.413,0.225,1.843,0.674c0.429,0.448,0.642,1.093,0.642,1.935v2.264H41.748z   M38.623,48.495c-0.271,0.336-0.669,0.501-1.187,0.501c-0.343,0-0.646-0.062-0.912-0.192c-0.267-0.129-0.519-0.327-0.746-0.601  v0.681h-1.764V36.852h1.764v3.875c0.237-0.27,0.485-0.478,0.748-0.616c0.267-0.143,0.534-0.212,0.805-0.212  c0.554,0,0.975,0.189,1.265,0.565c0.294,0.379,0.438,0.933,0.438,1.66v4.926C39.034,47.678,38.897,48.159,38.623,48.495z   M30.958,48.884v-0.976c-0.325,0.361-0.658,0.636-1.009,0.822c-0.349,0.191-0.686,0.282-1.014,0.282  c-0.405,0-0.705-0.129-0.913-0.396c-0.201-0.266-0.305-0.658-0.305-1.189v-7.422h1.744v6.809c0,0.211,0.037,0.362,0.107,0.457  c0.077,0.095,0.196,0.141,0.358,0.141c0.128,0,0.292-0.062,0.488-0.188c0.197-0.125,0.375-0.283,0.542-0.475v-6.744h1.744v8.878  H30.958z M24.916,38.6v10.284h-1.968V38.6h-2.034v-1.748h6.036V38.6H24.916z M32.994,32.978c0-0.001,12.08,0.018,13.514,1.45  c1.439,1.435,1.455,8.514,1.455,8.555c0,0-0.012,7.117-1.455,8.556C45.074,52.969,32.994,53,32.994,53s-12.079-0.031-13.516-1.462  c-1.438-1.435-1.441-8.502-1.441-8.556c0-0.041,0.004-7.12,1.441-8.555C20.916,32.996,32.994,32.977,32.994,32.978z M42.52,29.255  h-1.966v-1.08c-0.358,0.397-0.736,0.703-1.13,0.909c-0.392,0.208-0.771,0.312-1.14,0.312c-0.458,0-0.797-0.146-1.027-0.437  c-0.229-0.291-0.345-0.727-0.345-1.311v-8.172h1.962v7.497c0,0.231,0.045,0.399,0.127,0.502c0.08,0.104,0.216,0.156,0.399,0.156  c0.143,0,0.327-0.069,0.548-0.206c0.22-0.137,0.423-0.312,0.605-0.527v-7.422h1.966V29.255z M31.847,27.588  c0.139,0.147,0.339,0.219,0.6,0.219c0.266,0,0.476-0.075,0.634-0.223c0.157-0.152,0.235-0.358,0.235-0.618v-5.327  c0-0.214-0.08-0.387-0.241-0.519c-0.16-0.131-0.37-0.196-0.628-0.196c-0.241,0-0.435,0.065-0.586,0.196  c-0.148,0.132-0.225,0.305-0.225,0.519v5.327C31.636,27.233,31.708,27.439,31.847,27.588z M30.408,19.903  c0.528-0.449,1.241-0.674,2.132-0.674c0.812,0,1.48,0.237,2.001,0.711c0.517,0.473,0.777,1.083,0.777,1.828v5.051  c0,0.836-0.255,1.491-0.762,1.968c-0.513,0.476-1.212,0.714-2.106,0.714c-0.858,0-1.547-0.246-2.064-0.736  c-0.513-0.492-0.772-1.152-0.772-1.983v-5.068C29.613,20.954,29.877,20.351,30.408,19.903z M24.262,16h-2.229l2.634,8.003v5.252  h2.213v-5.5L29.454,16h-2.25l-1.366,5.298h-0.139L24.262,16z M33,64C16.432,64,3,50.569,3,34S16.432,4,33,4s30,13.431,30,30  S49.568,64,33,64z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://weibo.com/" target="_blank" class="link-transition linkedin link dib z-999 pt3 pt0-l mr1" title="LinkedIn link" rel="noopener" aria-label="follow on LinkedIn——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://mff-project.gitee.io/hugoblog/" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-label="follow on Github——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>


<a href="https://gitee.com/mff-project" target="_blank" class="link-transition gitlab link dib z-999 pt3 pt0-l mr1" title="Gitlab link" rel="noopener" aria-label="follow on Gitlab——Opens in a new window">
  <svg  height="32px"  style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z"></path></svg>

<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="8px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:;"/>
</svg>
</span></a>





</div>
  </div>
</footer>

    

  <script src="/hugoblog/dist/js/app.3fc0f988d21662902933.js"></script>


  </body>
</html>
